package com.wd.live.view;

import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;

import android.os.Bundle;
import android.view.View;

import com.wd.live.R;
import com.wd.live.base.BaseActivity;
import com.wd.live.base.BaseViewModel;
import com.wd.live.bean.FansBean;
import com.wd.live.databinding.ActivityFansBinding;
import com.wd.live.viewmodel.FansViewModel;

import java.util.List;

public class FansActivity extends BaseActivity<FansViewModel, ActivityFansBinding> {

    private int page=1;
    @Override
    protected void initData() {
        databind.backBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        viewmodel.getList(page).observe(FansActivity.this, new Observer<FansBean>() {
            @Override
            public void onChanged(FansBean fansBean) {
                List<?> result = fansBean.getResult();
                if(result.size()==0){
                    databind.noFans.setVisibility(View.VISIBLE);
                    databind.FLsmart.setVisibility(View.GONE);
                }
            }
        });
    }

    @Override
    protected int initLayout() {
        return R.layout.activity_fans;
    }

    @Override
    public void onChanged(Object o) {

    }
}